import java_cup.runtime.Symbol;

%%

%cup
%extends sym

%{ 

  private Symbol sym(int sym) {
    return new Symbol(sym);
  }

  private Symbol sym(int sym, Object val) {
    return new Symbol(sym, val);
  }
%}

%%


"!"            { return sym(NOT); }
"AND"          { return sym(AND); }
"NOT"          { return sym(NOT); }
"OR"           { return sym(OR); }
[a-zA-Z0-9]+   { return sym(ID,yytext()); }
"["             { return sym(LPAR); }
"("             { return sym(LPAR); }
")"             { return sym(RPAR); }
"]"             { return sym(RPAR); }
"\""            { return sym(DOUBLEQUOTE); }
[\ \t\b\f\r]+ { /* eat whitespace */ }
"\n"            { return sym(END);   }
.               { throw new Error("Unexpected character ["+yytext()+"]"); }
